package Reflex.多个参数的静态方法;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 失败
 */
public class MoreParamStaticMethodDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
        /**
         * 反射获取静态方法
         */
        //获取类  jdbc 叫加载驱动
        Class stuClass = Class.forName("Reflex.类.Student");
        //因为是静态方法，所有不需要实例化
        /*Student stuInstance = (Student)stuClass.newInstance();*/
        //参数类型，按顺序填写
        Method staticMethod = stuClass.getMethod("moreParamMethod", int.class, String.class, char.class);
        //多个参数，用数组接收并且一定要按顺序依次写入数组
        Object[] params  = {100,"abc",'$'};
        //援引,                 //有多个参数一定要转为    Object数组   类型
        Object invokeResult = staticMethod.invoke(null, params);
        System.out.println(invokeResult);
    }
}
